
if __name__ == '__main__':
    while True:
        try:
            s = input().strip()
            dic = {}
            # chars = list(map(int, s.split(" ")))
            for c in s.split(""):
                if c in dic:
                    dic[c] = dic[c] + 1
                else:
                    dic[c] = 1

            ss = sorted(dic.items(), key=lambda x: x[0])
            ss = sorted(ss, key=lambda x: x[1], reverse=True)
            print("".join([item[0] for item in ss]))
        except:
            break
